<?php 
require "DataLoad.php"; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html>
<head>
<title><?php echo $GuildName;?> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<?php echo $StylePath;?>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<?php echo $StylePath;?>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
<script type=text/javascript>
</script>

</head>

<body>

<div class="header">
<?php require "menu.php"; ?>
</div>
<div class="main">
<?php 
if (!is_numeric(${"id"})) {
	header("Location: ".$URL);
} 
switch (${"action"}) {
	case "confirm":
RaidReportEnd(${"id"});
		break;
	default:

confirm();
		break;
} 

//人员DKP
?>
</div>
<?php require "footer.php"; ?>
</body>
</html>
<?php 
function confirm() {
	extract($GLOBALS);

	print "<table class='outframe'>";
	print "<tr><th>将活动归档</th></tr>";
	print "<tr><td>活动一旦归档就无法再做任何修改,依照目前报告得出的DKP将被累加到每个成员的基础分上,此后生成的DKP详表将不显示此次活动.</td></tr>";
	print "<tr><td>确定要归档这个活动报告吗?</td></tr>";
	print "<tr><td><b>注意:你无法撤销这个操作!</b></td></tr>";
	print "<tr><td><a href='?action=confirm&id=".${"id"}."' class='abtn3'>是的,我要归档.</a> <a href='/' class='abtn2'>取消并返回</a></td></tr>";
	print "</table>";
	return $function_ret;
} 


function RaidReportEnd($id) {
	extract($GLOBALS);

//标记Raid归档
	$sql="select * from raid where id=".$id;
	$result = mysql_query($sql);$sql  $conn
	if ($result["raid_step"]>1) {

		print "内部错误C0013";
		return $function_ret;

	} 

	$result["raid_step"]=3;
	$raid_actiontime=$result["raid_actiontime"];
	$raid_class=$result["raid_class"];
	$result->update;
	$result->close;

//累计分数 , 参加次数+1
	$sql="select * from dkplist where raidid=".$id;
	$result = mysql_query($sql);$sql  $conn
	for ($i=1; $i<=$result->recordcount; $i=$i+1) {
		$conn->execute("update player_dkp set player_BaseDKP=player_BaseDKP+".$result["dkp"]." where raid_class=".$raid_class." and player_id=".$result["playerid"]);
		$conn->execute("update player set player_raidnum=player_raidnum+1 where id=".$result["playerid"]);
		$result->movenext;

	}

	$result->close;
//删除Raid在DKPLIST中的条目
	$conn->execute("Delete * from dkplist where raidid=".$id);

//公会活动次数+1
	$conn->execute("Update guild set guild_raidnum=guild_raidnum+1");

//获得装备写入
	$sql="select * from raid_event where event_raidid=".$id." and event_class='拾取' ";
	$result = mysql_query($sql);$sql  $conn
	for ($i=1; $i<=$result->recordcount; $i=$i+1) {
		$conn->execute("Update player set player_looted=player_looted+'|".$result["event_object2"]."' where id=".intval($result["event_object"]));
		$result->movenext;

	}

	$result->close;

	header("Location: "."admin_report.php");
	return $function_ret;
} 


?>
